package cn.jiyun.usain.service.impl;

import cn.jiyun.usain.mapper.StudentMapper;
import cn.jiyun.usain.pojo.Student;
import cn.jiyun.usain.service.HelloService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentImpl extends ServiceImpl<StudentMapper,Student> implements HelloService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public void add(Student student) {
        studentMapper.insert(student);
    }

    @Override
    public List<Student> findAll() {
        List<Student> students = studentMapper.selectList(null);
        return students;
    }

    @Override
    public Student findById(int id) {
        Student student = studentMapper.selectById(id);
        return student;
    }

    @Override
    public void update(Student student) {
        studentMapper.updateById(student);
    }

    @Override
    public void delete(Integer id) {
        studentMapper.deleteById(id);
    }


}
